'''
Created on Jun 28, 2013

@author: LuciaWilliams
'''
import itertools as it
import copy
import networkx as nx
J = nx.Graph
H = nx.Graph
I = nx.Graph
l = [[1, 2, 3], ["A", "B", "C"], ["a", "b", "c"], [".", "..", "..."]]
j = [[H, I, J], [H, I, J], [H, I, J]]

a = [[]]
b = [[4], 5]
c = [555, 333]

m = [[a, b, c], [a, b]]


NUM_USERS = len(l)
def all_paths(list_of_paths_by_user):
    all_combos = []
    combo = []
    all_paths_helper(list_of_paths_by_user, combo, all_combos)
    return all_combos


def all_paths_helper(list_of_paths_by_user, combo, all_combos):
    if list_of_paths_by_user:
        for x in list_of_paths_by_user[0]:
            already_examined = list_of_paths_by_user.pop(0)
            combo.append(x)
            all_paths_helper(list_of_paths_by_user, combo, all_combos)
            list_of_paths_by_user.insert(0, already_examined)
            combo.pop()
    else:
        print(combo)
        all_combos.append(copy.copy(combo))
        

print(all_paths(m))



        
